.class public Llecho/lib/hellocharts/formatter/ValueFormatterHelper;
.super Ljava/lang/Object;


# static fields
.field public static final DEFAULT_DIGITS_NUMBER:I = 0x0

.field private static final TAG:Ljava/lang/String; = "ValueFormatterHelper"


# instance fields
.field private appendedText:[C

.field private decimalDigitsNumber:I

.field private decimalSeparator:C

.field private prependedText:[C


# direct methods
.method public constructor <init>()V
    .locals 2

    const/4 v1, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/high16 v0, -0x80000000

    iput v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalDigitsNumber:I

    new-array v0, v1, [C

    iput-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    new-array v0, v1, [C

    iput-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependedText:[C

    const/16 v0, 0x2e

    iput-char v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalSeparator:C

    return-void
.end method


# virtual methods
.method public appendText([C)V
    .locals 4

    iget-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    array-length v0, v0

    if-lez v0, :cond_0

    iget-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    const/4 v1, 0x0

    array-length v2, p1

    iget-object v3, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    array-length v3, v3

    sub-int/2addr v2, v3

    iget-object v3, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    array-length v3, v3

    invoke-static {v0, v1, p1, v2, v3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    :cond_0
    return-void
.end method

.method public determineDecimalSeparator()V
    .locals 2

    invoke-static {}, Ljava/text/NumberFormat;->getInstance()Ljava/text/NumberFormat;

    move-result-object v0

    instance-of v1, v0, Ljava/text/DecimalFormat;

    if-eqz v1, :cond_0

    check-cast v0, Ljava/text/DecimalFormat;

    invoke-virtual {v0}, Ljava/text/DecimalFormat;->getDecimalFormatSymbols()Ljava/text/DecimalFormatSymbols;

    move-result-object v0

    invoke-virtual {v0}, Ljava/text/DecimalFormatSymbols;->getDecimalSeparator()C

    move-result v0

    iput-char v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalSeparator:C

    :cond_0
    return-void
.end method

.method public formatFloatValue([CFI)I
    .locals 2

    array-length v0, p1

    iget-object v1, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    array-length v1, v1

    sub-int/2addr v0, v1

    iget-char v1, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalSeparator:C

    invoke-static {p1, p2, v0, p3, v1}, Llecho/lib/hellocharts/util/FloatUtils;->formatFloat([CFIIC)I

    move-result v0

    return v0
.end method

.method public formatFloatValueWithPrependedAndAppendedText([CFI)I
    .locals 1

    const/4 v0, 0x0

    invoke-virtual {p0, p1, p2, p3, v0}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->formatFloatValueWithPrependedAndAppendedText([CFI[C)I

    move-result v0

    return v0
.end method

.method public formatFloatValueWithPrependedAndAppendedText([CFI[C)I
    .locals 3

    if-eqz p4, :cond_1

    array-length v0, p4

    array-length v1, p1

    if-le v0, v1, :cond_0

    const-string/jumbo v0, "ValueFormatterHelper"

    const-string/jumbo v1, "Label length is larger than buffer size(64chars), some chars will be skipped!"

    invoke-static {v0, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    array-length v0, p1

    :cond_0
    const/4 v1, 0x0

    array-length v2, p1

    sub-int/2addr v2, v0

    invoke-static {p4, v1, p1, v2, v0}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    :goto_0
    return v0

    :cond_1
    invoke-virtual {p0, p3}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->getAppliedDecimalDigitsNumber(I)I

    move-result v0

    invoke-virtual {p0, p1, p2, v0}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->formatFloatValue([CFI)I

    move-result v0

    invoke-virtual {p0, p1}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendText([C)V

    invoke-virtual {p0, p1, v0}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependText([CI)V

    invoke-virtual {p0}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->getPrependedText()[C

    move-result-object v1

    array-length v1, v1

    add-int/2addr v0, v1

    invoke-virtual {p0}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->getAppendedText()[C

    move-result-object v1

    array-length v1, v1

    add-int/2addr v0, v1

    goto :goto_0
.end method

.method public formatFloatValueWithPrependedAndAppendedText([CF[C)I
    .locals 1

    const/4 v0, 0x0

    invoke-virtual {p0, p1, p2, v0, p3}, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->formatFloatValueWithPrependedAndAppendedText([CFI[C)I

    move-result v0

    return v0
.end method

.method public getAppendedText()[C
    .locals 1

    iget-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    return-object v0
.end method

.method public getAppliedDecimalDigitsNumber(I)I
    .locals 1

    iget v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalDigitsNumber:I

    if-gez v0, :cond_0

    :goto_0
    return p1

    :cond_0
    iget p1, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalDigitsNumber:I

    goto :goto_0
.end method

.method public getDecimalDigitsNumber()I
    .locals 1

    iget v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalDigitsNumber:I

    return v0
.end method

.method public getDecimalSeparator()C
    .locals 1

    iget-char v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalSeparator:C

    return v0
.end method

.method public getPrependedText()[C
    .locals 1

    iget-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependedText:[C

    return-object v0
.end method

.method public prependText([CI)V
    .locals 4

    iget-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependedText:[C

    array-length v0, v0

    if-lez v0, :cond_0

    iget-object v0, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependedText:[C

    const/4 v1, 0x0

    array-length v2, p1

    sub-int/2addr v2, p2

    iget-object v3, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    array-length v3, v3

    sub-int/2addr v2, v3

    iget-object v3, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependedText:[C

    array-length v3, v3

    sub-int/2addr v2, v3

    iget-object v3, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependedText:[C

    array-length v3, v3

    invoke-static {v0, v1, p1, v2, v3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    :cond_0
    return-void
.end method

.method public setAppendedText([C)Llecho/lib/hellocharts/formatter/ValueFormatterHelper;
    .locals 0

    if-eqz p1, :cond_0

    iput-object p1, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->appendedText:[C

    :cond_0
    return-object p0
.end method

.method public setDecimalDigitsNumber(I)Llecho/lib/hellocharts/formatter/ValueFormatterHelper;
    .locals 0

    iput p1, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalDigitsNumber:I

    return-object p0
.end method

.method public setDecimalSeparator(C)Llecho/lib/hellocharts/formatter/ValueFormatterHelper;
    .locals 1

    const/4 v0, 0x0

    if-eq v0, p1, :cond_0

    iput-char p1, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->decimalSeparator:C

    :cond_0
    return-object p0
.end method

.method public setPrependedText([C)Llecho/lib/hellocharts/formatter/ValueFormatterHelper;
    .locals 0

    if-eqz p1, :cond_0

    iput-object p1, p0, Llecho/lib/hellocharts/formatter/ValueFormatterHelper;->prependedText:[C

    :cond_0
    return-object p0
.end method
